About PowerReplace 6.1 & Update Note 6/18/1997 Why? In the actual computer science world there are many text file formats, and we need often convert one format to another. Usually it means simply replace some strings by the others. Of course some text editors provide this possibility with “find and replace” command. But with this command it is almost impossible for a complicate multi-replace conversion. What Is It? PowerReplace is a powerful text conversion utility. It does the conversion using a small file called “Filter”. The syntax of filter is very easy to understand. PowerReplace is also an utility to build text conversion application. It can create small stand-alone daughter-application called “SelfReplace”, who makes your favorite conversion more easily and efficiently. PowerReplace can replace character (including NULL, CR, LF, TAB) or string by any other string. By use of the asterisk-sign(*) representing any indeterminate string, it can replace also a string only whose two extremities are known. It supports all character set, hexadecimal string and regular expression(pattern) for find/replace. Who Will Use It? All people who need to do some text conversion: Non programmer as well as programmer. How to Use It? A Simple Example To replace "à" by "à" and "é" by "é", follow these steps: (1) Launch PowerReplace application. (2) Write the following lines in the window "Untitled": "à" "à" "é" "é" (3) Click Convert File (or press ⌘E). That’s all. For complete information on this topic, see User’s Guide Chapter 4 - Tutorial. Features - High conversion speed and easy to use. - Easy to create new filter file. - Can copy resource and keep the same type-creator. This seems to me very important. For example I often use this option for convert TeX 8 bits file with pictures to TeX 7 bits file. In these files, pictures are stocked in the resource 'PICT'. - Easy to change filter file that will be remember in the preference file. - Can override old text file, or save output file with extension name. - Apple technology Support: Drag/Drop, Balloon Help, AppleScript. - and more… Documentation & Help - Launch PowerReplace application, from the Help menu, select PowerReplace User’s Guide… or Show Balloons.   - Visit my home page for general help. - Ask me if you wish. Distribution Shareware fee 25 US$. PowerReplace is copyright © 1993-97 by Guoniu Han, all rights reserved. PowerReplace may be used for a trial period of 4 weeks. If you decide to continue using it, you must register your copy. Paying is fairly simple. You have many ways to register PowerReplace. For more information about registration, see the "Registration Readme" File. Any SelfReplace applications you create using PowerReplace are copyright © 1993–97 by Guoniu Han, all rights reserved. You may create and distribute SelfReplace for your commercial or non-commercial applications, but without the registration code supplied to you. Contact the Author You can get more information about my programs for Apple Macintosh computer, and the latest version of PowerReplace at: http://130.79.4.26/~guoniu/mac/ Thank you for reporting any bug or suggestion to me at: Guoniu Han, 30, avenue du General de Gaulle, 67000 Strasbourg, France Email guoniu@math.u-strasbg.fr Web http://130.79.4.26/~guoniu/mac/ ___________________________________________________ Release Note ___________________________________________________ PowerReplace 6.1<1997.6.18> Change in Application • Added the time spent for conversion in the message window. • Fixed a bug in the replace engine. Thanks to Lothar Albaum. • Optimise for speed in many cases. Run more fast than previous version. • Simplifiy the user interface. Thanks to Godefroy Troude. Change in Regular Expression • Uppercase and lowercase are not ignored. • Support \t \r \n in regular expression. • Blanc line works correctly. Examples: '^ +' "" % OK. strip spaces at beginning of line. '^[\t ]+' "" % OK. strip spaces and tab at beginning of line. '^\r' "--\r" % OK. replace blanc line by --. '^$' "--\r" % OK. replace blanc line by --. '^$' "" % OK. remove blanc line '\r+' "\r" % OK. remove blanc line Change in Documentation • meta. The modification of the meta "\" is not valid for the regular expression. It is only valid for the first-string and second-string (with "). • NULL character in input file (Limitation) If your input file contains NULL characters (ascii = 0), PowerReplace may not work correctly. To solve this problem, you can save all NULL characters at the begin, and restore them at the end of your filter file. Your filter looks like: "\d000" "[NULL]" % make sur no [NULL] in input file ...... ...... ...... "[NULL]" "\d000" • Big Insertion (Limitation) If you use insertion tag "\>" in the second-string, then the first-string-found (the "source") must have less than 4096 characters. Bad example: Your input text is of length 10KB, and looks like Begin of file Chapter 1: Introduction ...... ...... ...... Chapter 9 : Conclusion Ene of file The following filter may cause error: "Chapter * :" "toto" because between "Chapter 1" and ":", there is no space. If there is no " :" in the middle of your input text, then the first-string-found is: Chapter 1: Introduction ...... ...... ...... Chapter 2 : ___________________________________________________ PowerReplace 6.0 <1997.6.2> New features: Line Editor for filter line Using Line Editor to Edit Long Line A good line in the filter window is like the following: first-stuff second-stuff the-rest If you have a long line in the filter window to edit, keep the cursor in that line and select "Line Editor" from the Edit menu. The Line Editor window displays. In this window, the first stuff, second stuff and the rest of that long line will be separated in three text fields. You can edit them more easily. ◊ We know that, in the first and second stuffs, \" represents ". In the line editor, we do NOT use this representation because there is no confusion. When back to the filter window by clicking the OK button, the line editor will replace " by \" automatically before making the long line. ◊ In the line editor, you can type CR or LF. When back to the filter window by clicking the OK button, the line editor will remove all CR and LF before making the long line. ◊ If the selected line is not a "good line", i.e., has no first stuff, or second stuff, then the line editor window does not display. ___________________________________________________ Version 5.7.2 <1997.05.20> New features: • Drop folder onto the application icon. If you drop folder onto the icon, PowerReplace converts all files in this folder and in the sub-folders of this folder by recurrence. If you can not drop folder onto the application icon, delete old version PowerReplace and all SelfReplace, then reconstruct the desktop. • Restore filter file from SelfReplace. To restore filter file from SelfReplace application (version >=5.7) , open SelfReplace application under Finder by double-click. Then click the button "Create Filter File". • Convert Clipboard from SelfReplace. To convert clipboard from SelfReplace application (version >=5.7) , open SelfReplace application under Finder by double-click. Then click the button "Convert Clipboard". • SelfReplace application code: 68K, PPC, FAT. Menu "Save As...". Choose the button "68K", "PPC", or "FAT". • Simple Output File Name. The formula for the output file name is: output file name = input name - deleteString + addString. For example, if input file name is "index.html", deleteString is ".html", and addString is ".tex". Then the output file name will be "index.tex". If the deleteString can not be found, at the end of the input file name, then ignore the deleteString. Change deleteString and addString in the "Information Window" of the filter. • Specify input file. You can specify input files. 4 cases: - all type, - all text file of type 'TEXT', - the name extension is the string ".html", - the name extension is NOT the string ".gif". You can change ".html" and ".gif" by other strings. Change this option in the "Information Window" of the filter. Version 5.6 <1997.03.07> New features: - Added Control menu. - Added “Input”, “Output” windows, and “Convert In->In”, “Convert In->Out” buttons. Now, You can write and debug complicate filter very easily. - Can set the type of filter by using #type 1 or #type 2. - Support for multi-insertion tag in the second string. - Show marked filter's name in toolbar. - Added new filters Bugs fixed: - If no resource data, create it. - very long line in filter. ______________________________ Guoniu Han, 30, avenue du General de Gaulle, 67000 Strasbourg, France Email guoniu@math.u-strasbg.fr Web http://130.79.4.26/~guoniu/mac/